package com.example.dao;

import com.example.model.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Hello
 * @since 2024-07-09
 */
public interface ProductMapper extends BaseMapper<Product> {
    @Select("SELECT * FROM product WHERE is_listed=1")
    List<Product> getAllListedProduct();

    @Select("SELECT * WHERE is_listed=1 AND restaurant_id=#{restaurant}")
    List<Product> getAllByRestaurantId(@Param("restaurantId") String restaurantId);
   /* @Select("SELECT product_name FROM product WHERE is_listed=1 AND restaurant_id= #{restaurantId}")
    List<String> getProductNameByRestaurantId(@Param("restaurantId")String restaurantId);

    @Select("SELECT product_image FROM product WHERE is_listed=1 AND restaurant_id= #{restaurantId}")
    List<String> getProductImageByRestaurantId(@Param("restaurantId")String restaurantId);

    @Select("SELECT product_points FROM product WHERE is_listed=1 AND restaurant_id= #{restaurantId}")
    List<Integer> getProductPointsByRestaurantId(@Param("restaurantId")String restaurantId);

    @Select("SELECT stock FROM product WHERE is_listed=1 AND restaurant_id= #{restaurantId}")
    List<Integer> getStockByRestaurantId(@Param("restaurantId")String restaurantId);

    @Select("SELECT sold FROM product WHERE is_listed=1 AND restaurant_id= #{restaurantId}")
    List<Integer> getSoldByRestaurantId(@Param("restaurantId")String restaurantId);
*/

}
